const arr = [[1, 2], 3, [4, 5]];
arr.reduce(function(prev, cur, index, array){
  console.log(prev, cur, index);
  return prev + cur;
}, []);